package com.itheima.controller;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class test {
    public static void main(String[] args) {
        String storedHash = "$2a$10$3xW2nBjwBM3rx1LoYprVsemNri5bvxeOd/QfmO7UDFQhW2HRHLi.C";

        // 用户输入的密码
        String userInputPassword = "1234";

        // 创建BCryptPasswordEncoder实例
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();

        // 验证密码
        boolean isPasswordMatch = passwordEncoder.matches(userInputPassword, storedHash);

        if (isPasswordMatch) {
            System.out.println("密码匹配！");
        } else {
            System.out.println("密码不匹配！");
        }
    }
    }

